<?php defined('SYSPATH') or die('No direct script access.');
/**
* Module Dashboard
*/
class Module_lappengeluaransukucadang_lappengeluaransukucadang {
	
	private $controller;
	private $ss;
	private $message;
	private $thesystems;
	private $mydatetime;
	private $arraylist;
	
	static function &factory() {
	   $o = new Module_lappengeluaransukucadang_lappengeluaransukucadang();
	  return $o;	
	}
	
	public function __construct()
	{
		$this->controller	= Request::current()->controller();
		$this->ss					= Session::instance();
		$this->thesystems	= Helper_theSystems::factory();
		$this->mydatetime	= Helper_MyDateTime::factory();
		$this->message		= Language_Message::factory();
		$this->arraylist	= Helper_ArrayList::factory();
	}
	
	public function lappengeluaransukucadang($id, $command)
	{
			$tglawal  = Arr::get($_REQUEST,'tglawal');	
			$tglakhir = Arr::get($_REQUEST,'tglakhir');
		
 		$lappengeluaransukucadanglists = DB::select()
		->from('surat_pengeluaran_sukucadang');
		if(!empty($tglawal)) {
			$lappengeluaransukucadanglists = $lappengeluaransukucadanglists->where(DB::expr('YEAR(tgl)'),'>=',$this->mydatetime->mktime_from_sql($tglawal,'Y'))
				->where(DB::expr('MONTH(tgl)'),'>=',$this->mydatetime->mktime_from_sql($tglawal,'m'))
				->where(DB::expr('DAY(tgl)'),'>=',$this->mydatetime->mktime_from_sql($tglawal,'d'));
		}
		if(!empty($tglakhir)) {
			$lappengeluaransukucadanglists = $lappengeluaransukucadanglists->where(DB::expr('YEAR(tgl)'),'<=',$this->mydatetime->mktime_from_sql($tglakhir,'Y'))
				->where(DB::expr('MONTH(tgl)'),'<=',$this->mydatetime->mktime_from_sql($tglakhir,'m'))
				->where(DB::expr('DAY(tgl)'),'<=',$this->mydatetime->mktime_from_sql($tglakhir,'d'));
		}

		$lappengeluaransukucadanglists = $lappengeluaransukucadanglists->execute()->as_array();
		
		$content['title']		= 'User Administrator';
		$content['content']	= View::factory('inc/lappengeluaransukucadang')
			->set('lappengeluaransukucadanglists',$lappengeluaransukucadanglists)
			->render();
		
		return $content;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}